<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>exercise</title>
    <style type="text/css" media="screen">
        .haha{
            position:absolute;
            top:50%;
            left:50%;
            transform:translate(-50%,50%);
        }
        .left{
            position:absolute;
            left:10px;
        }
        .right{
            position:absolute;
            right:10px;
        }
    </style>
</head>


<body>
<h1 onclick="taozou(this)">  </h1><!--一点击鼠标就会拿到h1-->
<script type="text/javascript">//在这里写代码
    /*alert("我的JavaScript");*/
    function taozou(a){
        console.log(a);
        if(a.classList.contains('left');){
            a.classList.contains('left');
        }

    }


    var num=0;
    setInterval(function() {
        var dd = document.querySelector("h1");
        if (num++ % 2 == 0) {
            dd.innerHTML = "遥看";
        } else {
            dd.innerHTML = "李白";
        }

        if (num == 5) {
            dd.classList.add("haha");
        }
    },2000);
    //输出：1、innerHTML
</script>
</body>
</html>